package com.study.design.composite;

import lombok.extern.slf4j.Slf4j;


/**
 * @version V1.0
 * @title: Main
 * @description: ${DESCRIPTION}
 * @author: wanghuilong
 * @date: 2019-07-29 10:49
 * @copyright: http://fingo.com.my/
 */
@Slf4j
public class Main {
    public static void main(String[] args) {
        log.info("addLogStart main InputParam: args : {} ", args);

        Composite root = new Composite("root");
        root.Add(new Leaf("Leaf A"));
        root.Add(new Leaf("Leaf B"));

        Composite comp = new Composite("Composite X");
        comp.Add(new Leaf("Leaf XA"));
        comp.Add(new Leaf("Leaf XB"));

        root.Add(comp);

        Composite comp2 = new Composite("Composite XY");
        comp2.Add(new Leaf("Leaf XYA"));
        comp2.Add(new Leaf("Leaf XYB"));

        root.Add(comp2);

        root.Add(new Leaf("Leaf C"));

        Leaf leaf = new Leaf("Leaf D");
        root.Add(leaf);
        root.Remove(leaf);

        root.Display(1);
    }
}
